
from sklearn.neighbors import KNeighborsRegressor


# 2. 准备数据
x_train = [[25,80,10,10],[27,65,15,20],[30,90,5,0],[22,40,12,5],
           [28,70,8,30],[29,85,11,15],[26,75,9,50],[24,60,6,25],[31,95,14,5]
           ,[21,50,4,10]]

# 需要预测的样本特征
x_test = [[26,80,6,13]]

# 标签是明天的湿度
y_train = [28,26,32,20,30,31,27,23,33,19]
# 3.创建爱你knn分类模型
model = KNeighborsRegressor(n_neighbors=3)
# 4.模型训练
model.fit(x_train,y_train)
# 5.模型预测
y_test = model.predict(x_test)
print(f"分类预测结果为:{y_test}")
